package com.cpone.cloudweb.utils.bak;

/**
 * Created by chenchen on 2017/3/6.
 * ����������Spring��������bean�Ĺ�����
 * �˹��������ڷ�Spring���������Java-bean�� �����Spring���������bean��ʵ��
 */

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class SpringContext implements ApplicationContextAware {// extends ApplicationObjectSupport{

    private static ApplicationContext ac = null;
    private static SpringContext springContext = null;

    public synchronized static SpringContext init() {
        if (springContext == null) {
            springContext = new SpringContext();
        }
        return springContext;
    }

    public synchronized static Object getBean(String beanName) {
        return ac.getBean(beanName);
    }

    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ac=applicationContext;
    }
}

